<?php echo form_open('item/restock',array('method' => 'get')); ?>
<div class="header1">Search Options</div>
<div id="options">
	<ul style="display: inline;">
		<li><input type="checkbox" name="name" id="name"
		<?php if($name)echo 'checked';?> /> name</li>
		<li><input type="checkbox" name="barcode" id="barcode"
		<?php if($barcode)echo 'checked';?> /> barcode</li>
		<li><input type="checkbox" name="category" id="category"
		<?php if($category)echo 'checked';?> /> category</li>
		<li><input type="checkbox" name="manufacturer" id="manufacturer"
		<?php if($manufacturer)echo 'checked';?> /> manufacturer</li>
		<li><input type="text" name="search" class="textboxSearch"
			value="<?php echo $search; ?>"
			placeholder="please enter the keyword" maxlength="30" /> <input
			type="submit" id="btn_submit" class="buttonSearch" value="search">
		</li>
	</ul>
</div>

<?php echo form_close(); ?>

<script>
	$('#btn_submit').click( function(evt){
		if ($('#name').is(':checked') || $('#barcode').is(':checked') || $('#manufacturer').is(':checked') || $('#category').is(':checked')){
		}else{
			evt.preventDefault();
			alert('Please select at least one search option');
		}
	});
	
</script>
<br />
<div class="titleStyle1">Restock</div>
<br />
<?php 
if ($result == null || sizeof($result)==0){
	echo '<div class="information">';
	echo 'All items are above the minimum stock';
	echo '</div>';
}else{
	echo form_open('item/restock');
	echo '<div class="restockTable">';
	echo '<table id="resultTable">';
	echo '<tr>';
	echo '<td style="display:none;">';
	echo 'Item ID';
	echo '</td>';
	echo '<td>';
	echo 'Item Name';
	echo '</td>';
	echo '<td>';
	echo 'Item Barcode';
	echo '</td>';
	echo '<td>';
	echo 'Cost';
	echo '</td>';
	echo '<td>';
	echo 'Current Stock';
	echo '</td>';
	echo '<td>';
	echo 'Mininum Stock';
	echo '</td>';
	echo '<td>';
	echo 'Top up';
	echo '</td>';
	echo '</tr>';
	foreach ($result as $item){
		echo '<tr>';
		echo '<td style="display:none;">';
		echo $item->item_id;
		echo '</td>';
		echo '<td>';
		echo $item->item_name;
		echo '</td>';
		echo '<td>';
		echo $item->item_barcode;
		echo '</td>';
		echo '<td>';
		echo $item->item_cost;
		echo '</td>';
		echo '<td>';
		echo $item->inventory_current_stock;
		echo '</td>';
		echo '<td>';
		echo $item->inventory_min_stock;
		echo '</td>';
		echo '<td>';
		echo '<input class="textboxStyle4" type="number" name="'.$item->item_id.'" value ="0" min="0" />'; 
		echo '</td>';
		echo '</tr>';
	}
	echo '</table>';
	echo '</div>';
	echo '<br />';
	echo '<input class="buttonStyle2" type="submit" value="Submit" />';
	echo form_close();
}
?>
<!-- 
<script>
$('#resultTable').find('tr').click( function(){
	var item_id = $(this).find('td:first').text();
	if (item_id > 0 )
		window.location.replace('<?php echo site_url()?>' + '/branch/update/' + item_id);
});
</script>

 -->